package com.yuebao.event;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonCreator.Mode;
import com.fasterxml.jackson.annotation.JsonValue;

public enum EventType {
    
    REDUCE_FUND_STOCK(1,"扣减基金库存"),
    ROLLBACK_BILL(2,"回滚订单"),
    ROLLBACK_CACHE_FUND(3,"回滚内存库存");
    
    
    private int id;
    private String desc;
    
    private EventType(int id, String desc) {
        this.id = id;
        this.desc = desc;
    }
    
    @JsonValue
    public Integer getId() {
        return this.id;
    }
    
    public String getDesc() {
        return this.desc;
    }
    
    
    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static EventType fromValue(int id) {
        for (EventType e : values()) {
            if (e.id == id) {
                return e;
            }
        }
        return null;
    }
    
}
